<?php

class Dispatcher extends Controller {

    public static function run() {
	
        if (isset($_GET['controller']) && file_exists(PATH_CONTROLLERS . $_GET['controller'] . '.class.php')) {
            $controller = new $_GET['controller']();
        }
		else {
            $controller = new FrontOffice();
        }
        if (isset($_GET['method']) && method_exists($controller, $_GET['method'])) {
			$controller->$_GET['method']();
        }
		if ($controller->getAutoDisplay()) {
			$controller->display();
		}
		
    }

}

?>